package pdi.preprocessing;

import pdi.OpenCvCaller;
import pdi.core.Image;

public class BasicPreprocessing extends AbstractPreProcessing{

	private int medianRadius = 3;
	
	public BasicPreprocessing(int medianRadius) {
		super();
		this.medianRadius = medianRadius;
	}

	@Override
	public Image process(Image sample) {
		
		if(sample.getMatrixRepresentation() == null)
			throw new IllegalArgumentException("The input image need its matrix representation not null");
		
		Image ret = sample.clone();
		
		ret = OpenCvCaller.getInstance().convertToGrayScale(ret);
		ret = OpenCvCaller.getInstance().medianFilter(ret, medianRadius);
		
		return ret;
	}

	
}
